grammar Process;
@header
{
package test;

}

prog	:	alt;
//stat	:	(ID|INT)* time (ID|INT)*{System.out.println($time.value1+"."+$time.value2);};




alt	:	time (ID|INT|prep|COLON)* traffic prep a=ID (ID|INT|prep)*{System.out.println($time.value1+"."+$time.value2);
System.out.println(":"+$a.text);}|
(ID|INT)* traffic prep a=ID (ID|INT|prep)* time (ID|INT|prep|DOT)*{System.out.println($time.value1+"."+$time.value2+$a.text);};


traffic returns [String args]:TRAFFIC|TRAFFIC BLOCK;

prep	:	'at'|'in';






time returns [int value1,int value2]:timedef{$value1=$timedef.value1;   $value2=$timedef.value2;} |
timedef AM{$value1=$timedef.value1;   $value2=$timedef.value2;}|
timedef PM{
$value1=($timedef.value1+12); 
  $value2=$timedef.value2;};


timedef returns [int value1,int value2]	:	TIME{$value1=Integer.parseInt($TIME.text);}|
TIME DOT FRACT{$value1=Integer.parseInt($TIME.text);
$value2=Integer.parseInt($FRACT.text);};
COLON	:	':';
BLOCK	:	'block'|'jam';
TRAFFIC	:	'traffic'|'accident';
AM	:	'AM'|'am';
PM	:	'PM'|'pm';
DOT	:	'.';
ID  :   ('a'..'z'|'A'..'Z')+ ;
TIME	:	'10'|'11'|'12'|'13'|'14'|'15'|'16'|'17'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'18'|'19'|'20'|'21'|'22'|'23';
FRACT	:	('0'..'5')('0'..'9');
TA	: ('0'..'9');
INT :   '0'..'9'+ ;
NEWLINE:'\r'? '\n' ;
WS  :   (' '|'\t'|'\n'|'\r')+ {skip();} ;